<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { info } from '@/common/api/login'
import { storeToRefs } from 'pinia'
import { useCounterStore } from '@/store/index'
import { BASE_URL } from '@/config'
onLaunch(() => {
	const store = useCounterStore()
	const { logname, huanjing } = storeToRefs(store)
	const data = {
		tokenId: uni.getStorageSync('token')
	}
	
	if (BASE_URL === 'http://172.16.180.247:10001') {
		huanjing.value = 'local'
	} else if (BASE_URL === 'http://10.10.113.30:10001') {
		huanjing.value = 'fat'
	} else if (BASE_URL === 'http://172.16.197.14:10001') {
		huanjing.value = 'preannouncement'
	} else if(BASE_URL === 'http://172.16.197.56:10001') {
		huanjing.value = 'prod'
	}
	console.log('0000000', huanjing.value);
	info(data).then((res) => {
		console.log('开始', res);
		// uni.removeStorageSync('token')
		if (res.code !== 2000) {
			uni.reLaunch({
				url: '/pages/login/login',
			});
		} else {
			logname.value = '欢迎登录：' + res.data
		}
	})
});
onShow(() => {
	// console.log("App Show");
});
onHide(() => {
	// console.log("App Hide");
});
</script>
<style lang="scss">
@import "./uni_modules/vk-uview-ui/index.scss";
@import "design/global.scss";
</style>